package com.atguigu.gulimall.order.feign;

import com.atguigu.common.utils.R;
import com.atguigu.gulimall.order.domain.vo.WareSkuLockVO;
import com.atguigu.gulimall.order.feign.fallback.WareSkuFeignServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Description
 * @Author lhj
 * @Date 2024/5/2 16:18
 */
@FeignClient(name = "gulimall-ware", contextId = "WareSkuFeignService", fallback = WareSkuFeignServiceFallback.class)
public interface WareSkuFeignService {

    /**
     * 检查是否有库存
     * /ware/waresku/hasStock
     */
    @PostMapping("/ware/waresku/hasStock")
    R getSkuHasStock(@RequestBody List<Long> skuIds);

    /**
     * ware/wareinfo
     * 获取运费信息
     * @return
     */
    @GetMapping("/ware/wareinfo/getFreight")
    R getFreight(@RequestParam("addrId") Long addrId);

    /**
     * ware/waresku
     * 锁定库存
     * @param wareSkuLockVO
     * @return
     */
    @PostMapping("/ware/waresku/orderItemLock")
    R orderItemLock(@RequestBody WareSkuLockVO wareSkuLockVO);

}
